package com.base.rq.ctr;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Toast;

import com.base.rq.LOG;
import com.base.rq.R;
import com.rq.app_base.android.event.OnClick;
import com.rq.app_base.use.BaseController;

import androidx.annotation.RequiresApi;
import aoto.com.mylibrary.MediaTTSManager;
import aoto.com.mylibrary.WhyTTS;
import ecomm.lib_comm.permission.PermissionUtil;

/**
 * @author RQ
 * date    2021-07-12 9:01
 */
@RequiresApi(api = Build.VERSION_CODES.M)
public class MainController2 extends BaseController implements View.OnClickListener,
                                                               PermissionUtil.OnPermissionListener {
  @Override
  protected int getLayoutId() {
    return R.layout.activity_main_2;
  }

  WhyTTS whyTTS;

  @Override
  public void onViewCreated(Bundle savedInstanceState) {
    super.onViewCreated(savedInstanceState);
    setData2View(R.id.tv_bottom, System.currentTimeMillis() + "");
    whyTTS = MediaTTSManager.getInstance(getContext());
    whyTTS.resume();
    //    Speaker.instance(getContext()).init();
  }

  @Override
  @OnClick({R.id.tv_bottom})
  public void onClick(View v) {
    LOG.e("MainController2", "onClick.44:");
    if (v.getId() == R.id.tv_bottom) {
      LOG.e("MainController2", "onClick.46:");
      finishOK(System.currentTimeMillis()+"");
    }
    //    SystemTTS.getInstance(v.getContext()).playText("012345123");
  }

  @Override
  public void onPermissionOk() {
    Toast.makeText(getContext(), "点击", Toast.LENGTH_LONG).show();
    //    whyTTS.speak("中文播报。。。123");
    //    Speaker.instance(getContext()).speak("中文播报12344");
  }

}
